module Manager {

    export class DataManager {

        public static inst: DataManager;

        public score: number;
        public blood: number;
        public level: number;
        public levelUpScore: number;
        public bulletLevel: number;

        constructor() {
            if (DataManager.inst instanceof DataManager) {
                throw new Error("DataManager Is An Instance.");
            }
            this.startOrRestart();
        }

        public static getInstance(): DataManager {
            if (!(DataManager.inst instanceof DataManager)) {
                DataManager.inst = new DataManager();
            }
            return DataManager.inst;
        }

        public startOrRestart() {
            this.score = 0;
            this.blood = 5;
            this.level = 1;
            this.levelUpScore = 10;
            this.bulletLevel = 0;
        }

        public onLoop(): void {}

        public pause() {

        }

        public resume() {

        }

        public stop() {

        }

        public addScore(num: number) {
            this.score += num;
            if (this.score >= this.levelUpScore) {
                this.level += 1;
                this.levelUpScore += this.level * 5;
            }
        }
    }
}